//
//  AddClassOrCNView.m
//  IpadTestB
//
//  Created by edianzu on 2017/7/3.
//  Copyright © 2017年 ruilai. All rights reserved.
//

#import "AddClassOrCNView.h"

@implementation AddClassOrCNView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
-(instancetype)initWithFrame:(CGRect)frame{
    if ([super initWithFrame:frame]) {
        [self creatUI];
    }
    return self;
}

-(void) creatUI{
    self.backgroundColor = [UIColor whiteColor];
    //上方绿色VIEW
    self.greenView = [[UIView alloc]init];
    self.greenView.backgroundColor = UIColorFromRGB(26, 167, 157);
    [self addSubview:self.greenView];
    [self.greenView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.mas_equalTo(self);
        make.height.mas_equalTo(40*AutoScaleVertical);
    }];
    //提示
    self.remindLabel = [[UILabel alloc]init];
//    self.remindLabel.text = @"提示";
    self.remindLabel.textColor = [UIColor whiteColor];
    [self.remindLabel setTextAlignment:NSTextAlignmentCenter];
    self.remindLabel.font = [UIFont boldSystemFontOfSize:20*AutoScaleHorizontal];
    [self.greenView addSubview:self.remindLabel];
    [self.remindLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.greenView.mas_centerX);
        make.centerY.mas_equalTo(self.greenView.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(200*AutoScaleHorizontal, 20*AutoScaleVertical));
    }];
    //取消按钮
        self.cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.cancelBtn setImage:[UIImage imageNamed:@"cancelBtn"] forState:UIControlStateNormal];
        [self.greenView addSubview:self.cancelBtn];
        [self.cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.mas_equalTo(self.remindLabel.mas_centerY);
            make.right.mas_equalTo(self.greenView.mas_right).with.offset(-20*AutoScaleHorizontal);
            make.size.mas_equalTo(CGSizeMake(20*AutoScaleHorizontal, 20*AutoScaleVertical));
        }];
    
    self.infoTextField = [[UITextField alloc]init];
    self.infoTextField.font = [UIFont systemFontOfSize:20*AutoScaleHorizontal];
    self.infoTextField.textColor = [UIColor blackColor];
    [self addSubview:self.infoTextField];
    [self.infoTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.mas_centerX);
        make.centerY.mas_equalTo(self.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(400*AutoScaleHorizontal, 40*AutoScaleVertical));
    }];
    
    _lineview = [[UIView alloc]init];
    _lineview.backgroundColor = UIColorFromRGB(183, 183, 183);
    [self addSubview:_lineview];
    [_lineview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.infoTextField.mas_bottom);
        make.left.width.equalTo(self.infoTextField);
        make.height.mas_equalTo(1);
    }];
    
    self.sureBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.sureBtn.backgroundColor = UIColorFromRGB(26, 167, 157);
    self.sureBtn.layer.cornerRadius = 10;
    self.sureBtn.layer.masksToBounds = YES;
    [self.sureBtn setTitle:@"确定" forState:UIControlStateNormal];
    [self.sureBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self addSubview:self.sureBtn];
    [self.sureBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.mas_centerX);
        make.bottom.mas_equalTo(self.mas_bottom).with.offset(-40*AutoScaleVertical);
        make.size.mas_equalTo(CGSizeMake(90*AutoScaleHorizontal, 30*AutoScaleVertical));

    }];
    
}

@end
